//package com.hyperchain.interceptor;
//
//import cn.dev33.satoken.session.SaSession;
//import cn.dev33.satoken.stp.StpUtil;
//import cn.hutool.core.util.StrUtil;
//import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
///**
// * 拦截器
// */
//@Component
//public class interceptor implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        String authorization = request.getHeader("Authorization");
//        if(StrUtil.isBlank(authorization)){
//            response.setStatus(401);
//            response.setContentType("application/json;charset=UTF-8");
//            response.getWriter().write("请携带有效的token");
//            return false;
//        }
//
//        return true;
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//
//        System.out.println("Interceptor 后置");
//    }
//
//
//}
